package com.ticket.system.domain.enu;

import lombok.Getter;

@Getter
public enum OrderStatusEnum {

    ONE(1,"已占票等待支付"),
    TWO(2,"已支付"),
    THREE(3,"超时未支付自动取消"),
    FOUR(4,"已完成"),
    FIVE(5,"已支付等待退款"),
    SIX(6,"已关闭"),
    SEVEN(7,"退款中"),
    EIGHT(8,"已完成");

    private final int code;

    private final String value;

    OrderStatusEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static OrderStatusEnum indexOf(Integer code) {
        for (OrderStatusEnum obj : OrderStatusEnum.values()) {
            if (code.equals(obj.getCode())) {
                return obj;
            }
        }
        return null;
    }

    public static OrderStatusEnum indexOfMsg(String msg) {
        for (OrderStatusEnum obj : OrderStatusEnum.values()) {
            if (msg.equals(obj.getValue())) {
                return obj;
            }
        }
        return null;
    }

}
